package xianchenganquan;

public class RunnerableImpl2 implements Runnable{
    private static int tick =100;
    @Override
    public void   run() {
        while (true){
            test();
            if (tick<=0){
                break;
            }
        }
    }
    public static  synchronized  void test(){
        if (tick>0) {
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            tick --;
            System.out.println(Thread.currentThread().getName()+"变量"+tick);
        }
    }
}
